package com.xiaoyu.lanling.feature.pay.data

import com.xiaoyu.base.net.RequestCreator
import com.xiaoyu.lanling.common.config.HttpConfig
import com.xiaoyu.lanling.event.pay.PreparePayEvent
import com.xiaoyu.lanling.event.coin.CoinBalanceEvent
import com.xiaoyu.lanling.event.coin.CoinChargeEvent
import com.xiaoyu.pay.PayWay

object PayData {

    fun preparePay(requestTag: Any, productId: String, @PayWay payWay: String, from: String) {
        RequestCreator.create<PreparePayEvent>(requestTag, PreparePayEvent::class.java)
                .setRequestUrl(HttpConfig.PAY_PREPARE_PAY)
                .addQueryData("productId", productId)
                .addQueryData("payWay", payWay)
                .addQueryData("from", from)
                .enqueue()
    }

    fun payCoinProductListAndBalance(requestTag: Any) {
        RequestCreator.create<CoinChargeEvent>(requestTag, CoinChargeEvent::class.java)
                .setRequestUrl(HttpConfig.LANLING_COIN_PRODUCT_LIST_AND_BALANCE)
                .enqueue()
    }

    fun myCoin(requestTag: Any) {
        RequestCreator.create<CoinBalanceEvent>(requestTag, CoinBalanceEvent::class.java)
                .setRequestUrl(HttpConfig.COIN_MY_COIN)
                .enqueue()
    }
}